import AbstractOauthControlPanelApi from '@/api/user/abstractOauthControlPanelApi';
import LoginResponse from '@/structure/loginResponse';
import User from '@/structure/user';

/**
 * 钉钉控制器
 */
class DingTalkControlPanelApi extends AbstractOauthControlPanelApi {

  /**
   * 通过code获取登录信息
   * @param code codd
   */
  public loginByCode(code: string): Promise<LoginResponse<User>> {
    return super.get0(`${this.getBase()}/loginByCode`, {
      params: {
        code
      }
    });
  }

  protected getBase(): string {
    return 'user/user/dingTalk/controlPanel';
  }
}

export default new DingTalkControlPanelApi();
